cp $1 $1.ori
size=`du -b $1 | cut -f1`
echo "Size: $size"

start_time=$(date +%s)
bzip2 $1
finish_time=$(date +%s) 
end_size=`du -b $1.bz2 | cut -f1`
echo "Time bzip2 bits/byte: `echo "$end_size * 8 / $size" | bc -l`" 
echo "Time bzip2 duration: $((finish_time - start_time)) secs" 

start_time=$(date +%s)
bunzip2 $1.bz2
finish_time=$(date +%s) 
echo "Time bunzip2 duration: $((finish_time - start_time)) secs"

diff $1 $1.ori
RETVAL=$?
[ $RETVAL -eq 0 ] && echo Success
[ $RETVAL -ne 0 ] && echo Failure


start_time=$(date +%s)
zip $1.zip $1
rm $1
finish_time=$(date +%s) 
end_size=`du -b $1.zip | cut -f1`
echo "Time zip bits/byte: `echo "$end_size * 8 / $size" | bc -l`" 
echo "Time zip duration: $((finish_time - start_time)) secs" 

start_time=$(date +%s)
unzip $1.zip
rm $1.zip
finish_time=$(date +%s) 
echo "Time unzip duration: $((finish_time - start_time)) secs"

diff $1 $1.ori
RETVAL=$?
[ $RETVAL -eq 0 ] && echo Success
[ $RETVAL -ne 0 ] && echo Failure

start_time=$(date +%s)
./tp-compress -c $1 -logLevel off
finish_time=$(date +%s) 
end_size=`du -b $1.vavoom | cut -f1`
echo "Time vavoom -c bits/byte: `echo "$end_size * 8 / $size" | bc -l`" 
echo "Time vavoom -c duration: $((finish_time - start_time)) secs" 

start_time=$(date +%s)
./tp-compress -x $1.vavoom -logLevel off
finish_time=$(date +%s) 
echo "Time vavoom -x duration: $((finish_time - start_time)) secs"

diff $1 $1.ori
RETVAL=$?
[ $RETVAL -eq 0 ] && echo Success
[ $RETVAL -ne 0 ] && echo Failure

